package com.emser.unc.activitys;



import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
import android.view.WindowManager;

import com.emser.unc.R;


public class SplashActivity extends Activity {
	
	Handler handler;
	Thread thread;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
	    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
	    setContentView(R.layout.p_main);
	    handler = new Handler();
	}
	
	@Override
	protected void onResume() {
	    super.onResume();
	    thread = new Thread() {
	        @Override
	        public void run() {
	            try {
	                Thread.sleep(5000);
	                handler.post(new Runnable() {
	                    public void run() {
	                        goToNextScreen();
	                        finish();
	                    }
	                });
	            } catch (InterruptedException e) {
	            }
	        }
	    };
	    thread.start();
	}

	protected void goToNextScreen() {
	    Intent intent = new Intent(this, LoginActivity.class);
	    startActivity(intent);
	}
	
}